<?php

namespace App\Http\Controllers\Api;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Http\Requests\UserRequest;
use App\Http\Resources\User;


/**
 * @resource 用户
 *
 * Class UserController
 * @package App\Http\Controllers\Api
 */
class UserController extends Controller
{

    /**
     * 修改用户信息
     *
     * @param UserRequest $request
     */
    public function modify(UserRequest $request)
    {
        $user = $request->user();
        $user->fill($request->all())->save();
        return new User($user);
    }

    /**
     * 用户信息
     *
     * @param Request $request
     * @return User
     */
    public function show(Request $request)
    {
        return new User($request->user());
    }
}
